package o;

import com.huawei.appgallery.foundation.account.bean.UserSession;
import com.huawei.gamebox.plugin.gameservice.bean.GameInfo;
import com.huawei.gamebox.plugin.gameservice.bean.GetGameNoticeResp;
import com.huawei.gamebox.plugin.gameservice.bean.NoticeMap;
import com.huawei.gamebox.plugin.gameservice.db.tables.GameNoticeRecord;
import com.huawei.hwid.core.constants.HwAccountConstants;
import java.util.Calendar;

class ezz {
    private NoticeMap ˊ;
    private GetGameNoticeResp ˋ;
    private long ˎ;
    private String ˏ;
    private GameNoticeRecord ॱ = new GameNoticeRecord();
    private long ॱॱ;

    ezz(GameInfo gameInfo, GetGameNoticeResp getGameNoticeResp, long j, long j2) {
        this.ˏ = gameInfo.getAppId();
        this.ˋ = getGameNoticeResp;
        this.ˊ = getGameNoticeResp.ˋ();
        this.ˎ = j;
        this.ॱॱ = j2;
    }

    private boolean ˏ() {
        String ˎ = ˎ();
        if (this.ॱ.ॱ().equals(ˎ)) {
            return false;
        }
        this.ॱ.ॱ(ˎ);
        return true;
    }

    private String ˎ() {
        return new StringBuffer().append(Calendar.getInstance().get(1)).append(HwAccountConstants.BLANK).append(Calendar.getInstance().get(2) + 1).append(HwAccountConstants.BLANK).append(Calendar.getInstance().get(5)).toString();
    }

    private boolean ॱ() {
        if (this.ॱ.ॱॱ().equals(this.ˊ.ʽ())) {
            return false;
        }
        this.ॱ.ˏ(this.ˊ.ʽ());
        return true;
    }

    private boolean ˋ() {
        String userId = UserSession.getInstance().getUserId();
        if (userId == null) {
            userId = "DefaultUser";
        }
        if (this.ॱ.ˎ().equals(userId)) {
            return false;
        }
        this.ॱ.ˊ(userId);
        return true;
    }

    private boolean ʻ() {
        long j = this.ॱॱ - this.ˎ;
        long ॱ = ((long) this.ˋ.ॱ()) * 1000;
        ezy.ˏ().ˋ(this.ˏ, ॱ);
        if (ॱ <= 0 || j <= ॱ) {
            return true;
        }
        if (Logger.ˎ()) {
            Logger.ˏ("NoticeInfoRule", "interval time longer than controlTime");
        }
        return false;
    }

    private void ॱॱ() {
        if (this.ˊ.ˏ() == null) {
            this.ॱ.ˎ(-1);
            return;
        }
        try {
            int parseInt = Integer.parseInt(this.ˊ.ˏ());
            if (parseInt >= -1) {
                this.ॱ.ˎ(parseInt);
            }
        } catch (Exception e) {
            this.ॱ.ˎ(-1);
            Logger.ˎ("NoticeInfoRule", "parse PopTime error");
        }
    }

    boolean ˊ() {
        boolean z = false;
        if (ᐝ()) {
            GameNoticeRecord ˎ = ezf.ˊ().ˎ(this.ˏ);
            if (ˎ != null) {
                this.ॱ = ˎ;
            } else {
                this.ॱ.ˎ(this.ˏ);
            }
            ॱॱ();
            if (ˏ()) {
                this.ॱ.ˏ(0);
            }
            if (ॱ()) {
                this.ॱ.ˏ(0);
            }
            if (ˋ()) {
                this.ॱ.ˏ(0);
            }
            if ((this.ॱ.ˊ() < 0 || this.ॱ.ˋ() < this.ॱ.ˊ()) && !this.ˊ.ˊ().equals("0") && ʻ()) {
                z = true;
                this.ॱ.ˏ(this.ॱ.ˋ() + 1);
            }
            if (Logger.ˎ()) {
                Logger.ˏ("NoticeInfoRule", "isShowNotice :" + this.ˊ.ˊ() + " nowNums:" + this.ॱ.ˋ() + " maxNums:" + this.ॱ.ˊ());
            }
            ezf.ˊ().ˏ(this.ॱ);
        }
        return z;
    }

    private boolean ᐝ() {
        if (!dof.ˋ(this.ˊ.ʽ()) && !dof.ˋ(this.ˊ.ˊ()) && !dof.ˋ(this.ˏ) && !dof.ˋ(this.ˊ.ॱ())) {
            return true;
        }
        Logger.e("NoticeInfoRule", "Notice param check failed");
        return false;
    }
}
